package com.deco.back.controller.content;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.deco.domain.vo.brand.BrandStoryVo;
import com.deco.domain.vo.sys.CmsAdvTypeVo;
import com.deco.domain.vo.sys.CmsAdvVo;
import com.deco.domain.vo.sys.CmsMediaTypeVo;
import com.deco.domain.vo.sys.CmsMediaVo;
import com.deco.service.brand.BrandStoryService;
import com.deco.service.sys.CmsAdvService;
import com.deco.service.sys.CmsMediaService;
import com.deco.service.sys.CmsMediaTypeService;
import com.free.common.vo.PageResponseVo;
import com.free.common.vo.PageSearchVo;
import com.free.common.vo.ResultModel;
import com.free.ext.web.spring.annoation.PageSearch;

/**
 * 文件管理 Controller
 * @author lengy
 *
 */
@Controller
public class CmsMediaTypeController {
    @Autowired
    private CmsMediaTypeService cmsMediaTypeService;
    

    @RequestMapping(value = "/cms_media_type_list.do")
    public ModelAndView listPage(){
        ModelAndView mv = new ModelAndView("content/cmsmediatypelist");
        return mv;
    }

    @RequestMapping(value= "/cms_media_type_list_page.do")
    @ResponseBody
    public PageResponseVo<CmsMediaTypeVo> getList(@PageSearch PageSearchVo<CmsMediaTypeVo> condition){
        return cmsMediaTypeService.pageInfo(condition);
    }

    @RequestMapping(value = "/cms_media_type_edit.do")
    public ModelAndView editFixType(Integer id){
    	CmsMediaTypeVo vo = null;
        ModelAndView mv = new ModelAndView("content/cmsmediatypeedit");
        if(id != null){
            vo = cmsMediaTypeService.getCmsMediaType(id);
            mv.addObject("actNm","更新");
        }else{
            vo = new CmsMediaTypeVo();
            vo.setId(0);
            mv.addObject("actNm","新增");
        }
        mv.addObject("obj",vo);
        return mv;
    }

    @RequestMapping(value ="/cms_media_type_del.do")
    @ResponseBody
    public ResultModel batchDelete(@RequestParam(value = "ids[]")Integer[] ids){
        return cmsMediaTypeService.batchDelete(ids);
    }

    @RequestMapping(value ="/cms_media_type_edit_submit.do")
    @ResponseBody
    public ResultModel udpate(CmsMediaTypeVo vo){
        return cmsMediaTypeService.save(vo);
    }
}
